package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.PurchaseListDao;
import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.domain.SuccessCode;
import com.atguigu.jxc.entity.PurchaseList;
import com.atguigu.jxc.service.PurchaseListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * description
 *
 * @author SZ
 * @date 2022/9/25/11:29
 */
@Service
public class PurchaseListServiceImpl implements PurchaseListService {
    @Autowired
    private PurchaseListDao purchaseListDao;

    @Override
    public void save(PurchaseList purchaseList) {
        purchaseListDao.insert (purchaseList);
    }

    @Override
    public List<PurchaseList> list(String purchaseNumber, Integer supplierId, Integer state, String sTime, String eTime) {
        return purchaseListDao.getList (purchaseNumber, supplierId, state, sTime, eTime);
    }

    @Override
    public ServiceVO deleteById(Integer purchaseListId) {
        if (purchaseListId != null) {
            purchaseListDao.deleteById (purchaseListId);
        }
        return new ServiceVO (SuccessCode.SUCCESS_CODE, SuccessCode.SUCCESS_MESS);
    }


}
